﻿<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%Response.Charset="utf-8"%>
<!--#include file="const.asp" -->
<!--#include file="common/sha1.asp" -->
<!--#include file="common/funciton.asp" -->
<%sub showmessage(msg)%>
<% ="<script language='javascript'>alert('"&msg&"');history.back()</script>" %>
<%response.end 
end sub 
if Session(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_sjcode")<>Request.form("DigtalStr") then
%>
<script language="javascript">
		     if(confirm("验证码错误,<%=Session(seesionname&"_login_"&request.Cookies(cookiesname&"_Login_sjcode")&"_sjcode")%>,<%=Request.form("DigtalStr")%>"))
		    {
		         location.href="Register.asp";
		     }
		    else
		    {
		         location.href="default.asp";
		     }
		</script>
<%
else
jc=""
UserName=trim(request.form("UserName"))
Password=trim(request.form("Password"))
rePass=trim(request.form("rePass"))
Email=trim(request.form("Email"))
birthday=trim(request.form("birthday-y"))&"-"&trim(request.form("birthday-m"))&"-"&trim(request.form("birthday-d"))
msn=trim(request.form("msn"))
qq=trim(request.form("qq"))
tel=trim(request.form("tel"))
if UserName="" or Password="" or rePass="" or Email="" then
   showmessage "有必填项目没有填写！"
end if

if Password<>rePass then
  showmessage "两次输入的密码不一样！"
end if
set xmldoc=server.createObject("MSXML.DOMDocument")
xmldoc.async="false"
xmldoc.load(strSourceFile)

for i=0 to usernums
jcun=xmlDoc.DocumentElement.childNodes.item(2).childNodes.item(i).childNodes.item(0).text
   if jcun=UserName then
   set xmldoc=nothing
   showmessage "此登录名已被注册!"
   jc="b"
   exit for
   end if
next
   
   if jc="" then
   set root=xmlDoc.DocumentElement.childNodes.item(2)
   set newnode1=xmldoc.createElement("User")
   root.appendchild(newnode1)
set newnode2=xmldoc.createelement("UserName")
   newnode1.appendchild(newnode2)
   newnode2.text=UserName
set newnode2=xmldoc.CreateElement("Password")
   newnode1.appendchild(newnode2)
   newnode2.text=SHA256(Password)
set newnode2=xmldoc.createelement("Email")
   newnode1.appendchild(newnode2)
   newnode2.text=Email
set newnode2=xmldoc.createelement("birthday")
   newnode1.appendchild(newnode2)
   newnode2.text=birthday
set newnode2=xmldoc.createelement("msn")
   newnode1.appendchild(newnode2)
   newnode2.text=msn
set newnode2=xmldoc.createelement("qq")
   newnode1.appendchild(newnode2)
   newnode2.text=qq
set newnode2=xmldoc.createelement("tel")
   newnode1.appendchild(newnode2)
   newnode2.text=tel 
xmldoc.save (strSourceFile)

set xmldoc=nothing
%><center>&nbsp;祝贺你注册成功!<p><a href="login.asp">进入登录界面</a></p>
</center><%end if%> <%end if%></body></html>